home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Frameworks / TransSkel 3.24 / Documents / Tutorial / Examples / SimpleApp3.c < prev    next >
Text File  |  1996-01-17  |  1KB  |  61 lines

  1. # include   "TransSkel.h"
  2.  
  3.  
  4. static pascal void
  5. DoFileMenu (short item)
  6. {
  7.     SkelStopEventLoop ();            /* tell SkelEventLoop() to quit */
  8. }
  9.  
  10.  
  11. static pascal void
  12. Close (void)
  13. {
  14.     SkelStopEventLoop ();
  15. }
  16.  
  17.  
  18. static pascal void
  19. Clobber (void)
  20. {
  21. WindowPtr    w;
  22.  
  23.     GetPort (&w);
  24.     DisposeWindow (w);
  25. }
  26.  
  27.  
  28. int
  29. main (void)
  30. {
  31. MenuHandle    m;
  32. WindowPtr    w;
  33. Rect        r;
  34.  
  35.     SkelInit (nil);                /* initialize */
  36.     SkelApple (nil, nil);        /* handle Apple menu */
  37.     /* create File menu, install handler */
  38.     m = NewMenu (skelAppleMenuID + 1, "\pFile");
  39.     AppendMenu (m, "\pQuit/Q");
  40.     (void) SkelMenu (m,                    /* menu handle */
  41.                         DoFileMenu,        /* item selection function */
  42.                         nil,            /* menu disposal function */
  43.                         false,            /* not a submenu */
  44.                         true);            /* draw menu bar */
  45.  
  46.     SetRect (&r, 40, 40, 200, 120);
  47.     w = NewWindow (nil, &r, "\pA Window", true,
  48.                         documentProc+8, (WindowPtr) -1, true, 0L);
  49.     (void) SkelWindow (w,
  50.                         nil,        /* mouse click handler */
  51.                         nil,        /* key click handler */
  52.                         nil,        /* update event handler */
  53.                         nil,        /* activate event handler */
  54.                         Close,        /* close box click handler */
  55.                         Clobber,    /* disposal function */
  56.                         nil,        /* idle-time handler */
  57.                         true);        /* idle only when frontmost */
  58.     SkelEventLoop ();
  59.     SkelCleanup ();
  60. }
  61.